package org.example.mybatis.mapper;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
class IUserInfoMapper1Test {

    @Autowired
    private IUserInfoMapper1 iUserInfoMapper1;
    @Test
    void selectUserInfo() {
        System.out.println(iUserInfoMapper1.selectUserInfo(4));
    }


    @Test
    void selectUserInfo1() {
        System.out.println(iUserInfoMapper1.selectUserInfo1(4));
    }

    @Test
    void selectUserInfo2() {
        System.out.println(iUserInfoMapper1.selectUserInfo2("zhangsan"));
    }

    @Test
    void selectUserInfo3() {
        System.out.println(iUserInfoMapper1.selectUserInfo3("zhangsan"));//有错
    }

    @Test
    void selectUserInfo4() {
        System.out.println(iUserInfoMapper1.selectUserInfo4("zhangsan"));
    }

    //本来是输入用户的姓名，进行查询一个用户的信息，用户可以输入'or 1='1 查询到所有的信息，具有危险性
    @Test
    void selectUserInfo5() {
        System.out.println(iUserInfoMapper1.selectUserInfo4("'or 1='1"));
    }
}